<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	
	<script type="text/javascript">
	function jdbc(value)
	{
		if ("com.microsoft.sqlserver.jdbc.SQLServerDriver" == value)
		{
			document.getElementById("id_event_name").value = "gzyxbg";
			document.getElementById("ip").value = "192.168.0.112";
			document.getElementById("port").value = "1433";
			document.getElementById("user").value = "sa";
			document.getElementById("pwd").value = "123456";
		}
		else if("com.mysql.jdbc.Driver" == value)
		{
		    document.getElementById("id_event_name").value = "demo";
			document.getElementById("ip").value = "localhost";
			document.getElementById("port").value = "3306";
			document.getElementById("user").value = "root";
			document.getElementById("pwd").value = "root";
		}
		else
		{
			 document.getElementById("id_event_name").value = "security_db";
			document.getElementById("ip").value = "192.168.200.209";
			document.getElementById("port").value = "5432";
			document.getElementById("user").value = "root";
			document.getElementById("pwd").value = "sa123";
		}
	}
	
	</script>
  </head>
  
  <body>
    <a href="connectServlet">connection</a>
    <form method="post" id="formId" action="connectServlet">
	<!--operation_panel-->
	<table class="tableStyle">
		<tbody>
			<tr>
				<th>
					<label>连接数据库名</label><span class="required">*</span>
				</th>
				<td>
					<input type="text" maxlength="30" name="dbname" id="id_event_name" value="demo">
			</td>
			</tr>
			<tr>
				<th><label>连接地址</label></th>
			    <td>
				   <input name="ip" id="ip" maxlength="300" type="text" value="localhost" /><!-- '卡号' -->
			    </td>
			</tr>
			<tr>
				<th><label>端口</label></th>
				<td>
				  <input name="port" id="port" maxlength="300" type="text" value="3306" /><!-- '卡号' -->
				</td>
				<div id="ttt"></div>
			</tr>
			<tr>
				<th><label>驱动</label></th>
				<td>
				 <select id="driver" name ="driver" onchange="jdbc(this.value)">
				  <option value="com.mysql.jdbc.Driver" selected="selected">com.mysql.jdbc.Driver</option>
				  <option value="com.microsoft.sqlserver.jdbc.SQLServerDriver">com.microsoft.sqlserver.jdbc.SQLServerDriver</option>
				   <option value="org.postgresql.Driver">org.postgresql.Driver</option>
<!-- 				  <option value="oracle.jdbc.driver.OracleDriver">oracle.jdbc.driver.OracleDriver</option> -->
				 </select>
				</td>
				<div id="ttt"></div>
			</tr>
			<tr>
				<th><label>账号</label></th>
				<td>
				  <input name="user" id="user" maxlength="300" type="text" value="root" /><!-- '卡号' -->
				</td>
				<div id="ttt"></div>
			</tr>
			<tr>
				<th><label>密码</label></th>
				<td>
				  <input name="pwd" id="pwd" maxlength="300" type="password" value="root" /><!-- '卡号' -->
				</td>
				<div id="ttt"></div>
			</tr>
		</tbody>
	</table>
	<input type="submit" value="连接">
</form>
    <h1> <%=request.getAttribute("connect")%></h1>
  </body>
</html>
